<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>

<script type="text/javascript">
var request;

function crear() {
  request = new XMLHttpRequest();
  var c=document.getElementById('cont').value;
  var peticion_str = 'http://127.0.0.1:8080/contador/crear/'+c;
  request.open('POST', peticion_str , true);
  request.onreadystatechange=creado;
  request.send(null);
}

function creado(){
  if ( request.readyState == 4 ) {
    if ( request.status == 200 ) {
	 	alert('Contador creado');
  }
  }
}

function incrementar() {
  request = new XMLHttpRequest();
  var c=document.getElementById('contI').value;
  var peticion_str = 'http://127.0.0.1:8080/contador/incrementar/'+c;
  request.open('POST', peticion_str , true);
  request.onreadystatechange= incrementado ;
  request.send(null);
}

function incrementado(){
  if ( request.readyState == 4 ) {
    if ( request.status == 200 ) {
      alert('Contador incrementado');
  }
  }
}

</script>
</head>

<body>
<form action="javascript:crear()">
Crear contador: <input type="text" id="cont"  />
<input type="submit" value="Crear"/>
</form>
<br />
<form action="javascript:incrementar()">
<p>Incrementar el contador:  <input type="text" id="contI"  /></p>
<input type="submit" value="Incrementar"/>
</form>
</body>
</html>
